<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="shortcut icon" href="<!--{eval echo register_static('img/touch-icon-57x57.png');}-->">

    <title>粉粉管理系统</title>

    <!-- Bootstrap core CSS -->
    <link href="<!--{eval echo register_static('css/bootstrap.min.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/bootstrap-reset.css');}-->" rel="stylesheet">

    <!--Animation css-->
    <link href="<!--{eval echo register_static('css/animate.css');}-->" rel="stylesheet">

    <!--Icon-fonts css-->
    <link href="<!--{eval echo register_static('assets/font-awesome/css/font-awesome.css');}-->" rel="stylesheet" />
    <link href="<!--{eval echo register_static('assets/ionicon/css/ionicons.min.css');}-->" rel="stylesheet" />

    <link href="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.css');}-->" rel="stylesheet">

    <!-- Plugins css -->
    <link href="<!--{eval echo register_static('assets/modal-effect/css/component.css');}-->" rel="stylesheet">

    <!-- DataTables -->
    <link rel="stylesheet" href="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.css" rel="stylesheet');}-->" />

    <!-- Custom styles for this template -->
    <link href="<!--{eval echo register_static('css/style.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/helper.css');}-->" rel="stylesheet">

    <!-- My styles for this template -->
    <link href="<!--{eval echo register_static('css/common.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('assets/timepicker/bootstrap-timepicker.min.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('assets/timepicker/bootstrap-datepicker.min.css');}-->" rel="stylesheet">

</head>

<body id="mybody">

<!-- Aside Start-->
<!--{template admin_v2/leftside}-->
<!-- Aside Ends-->


<!--Main Content Start -->
<section class="content">

    <!-- Header -->
    <!--{template admin_v2/header}-->
    <!-- Header Ends -->


    <!-- Page Content Start -->
    <!-- ================== -->

    <div class="wraper container-fluid diary-topics">

        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default" style="overflow: auto;">
                    <div class="panel-heading">
                        <h3 class="panel-title">匿名热门待上线</h3>
                    </div>
                    <div class="panel-body">
                        <div class="row" style="margin-bottom: 10px">
                            <div class="col-md-9 col-sm-9 col-xs-9">
                                <!-- Search -->
                                <div class="form-inline">
                                    <!--<div style="display: inline-block; padding-right: 20px">筛选</div>
                                    <div class="form-group">
                                        <select class="form-control myChoose" name="type">
                                            <option value="no">类型(最新)</option>
                                            <option value="hot">类型(热门)</option>
                                        </select>
                                    </div>-->
                                    <div class="form-group pageCon">

                                    </div>
                                </div>
                            </div>
                            <div class="col-md-3 col-sm-3 col-xs-3">
                                <button class="btn btn-info myAdd"><i class="ion-plus-round"></i> 添加待上线</button>
                                <button class="btn btn-info toLine"><i class="ion-arrow-up-c"></i> 立即上线</button>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12 col-sm-12 col-xs-12">
                                <table id="datatable" class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th width="5%">bodyId</th>
                                        <th width="10%">内容</th>
                                        <th>背景</th>
                                        <th>uid</th>
                                        <th>权重</th>
                                        <th>创建于</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>

                                    <tbody id="tbody">

                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="row" style="margin-top: 15px">
                            <div class="form-group pageCon"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <!-- Page Content Ends -->
    <!-- ================== -->

    <div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">

    </div><!-- /.modal -->


    <!-- Footer Start -->
    <!--{template admin_v2/footer}-->
    <!-- Footer Ends -->



</section>
<!-- Main Content Ends -->

<!--template start-->
<script type="text/template" id="tableCon">
    {{#.}}
    <tr>
        <td><label class="label label-success">{{{bodyId}}}</label></td>
        <td><span style="color: #df8505">{{{content}}}</span></td>
        <td><img src="{{{bg_value}}}" width="100" class="showImg" /></td>
        <td>{{{uid}}}</td>
        <td>{{{score}}}</td>
        <td><label class="label label-info">{{{dateConv create_at}}}</label></td>
        <td>
            <div class="btn-group btn-group-sm">
                <button type="button" class="btn btn-danger myDelete" data-id="{{{bodyId}}}" data-uid="{{{uid}}}">移除</button>
                <button type="button" class="btn btn-info editSource" data-id="{{{bodyId}}}" data-score="{{{score}}}">调整权重</button>
                <button type="button" class="btn btn-info myDiscuss" data-id="{{{bodyId}}}" data-uid="{{{uid}}}">评论 ( {{{comment}}} )</button>
            </div>
        </td>
    </tr>
    {{/.}}
</script>


<script type="text/template" id="editModal">
    {{#.}}
    <form>
        <div>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="25%">类别</th>
                    <th width="75%">内容</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>类型</td>
                    <td>
                        <select style="height: 26px;" name="type">
                            {{{activityTypeSelect type}}}
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>图片链接</td>
                    <td>
                        <textarea class="form-control" rows="3" name="image_url">{{{image_url}}}</textarea>
                    </td>
                </tr>
                <tr>
                    <td>大图链接(<span style="color: red">仅每日一语使用</span>)</td>
                    <td>
                        <textarea class="form-control" rows="3" name="link_url">{{{link_url}}}</textarea>
                    </td>
                </tr>
                <tr>
                    <td>Action</td>
                    <td>
                        <textarea class="form-control" rows="3" name="action_url">{{{action_url}}}</textarea>
                    </td>
                </tr>
                <tr>
                    <td>名称</td>
                    <td>
                        <input type="text" name="name" class="form-control" placeholder="" value="{{{name}}}">
                    </td>
                </tr>
                <tr>
                    <td>标题</td>
                    <td>
                        <input type="text" name="title" class="form-control" placeholder="" value="{{{title}}}">
                    </td>
                </tr>
                <tr>
                    <td>内容</td>
                    <td>
                        <textarea class="form-control" rows="3" name="content">{{{content}}}</textarea>
                    </td>
                </tr>
                <tr>
                    <td>显示时间</td>
                    <td >
                        <div class="form-inline">
                            <div class="form-group">
                                <label>开始:</label>
                                <input type="text" name="start" class="form-control timepicker2"  placeholder="" value="{{{dateConv start}}}" style="width: 180px">
                            </div>
                            <div class="form-group">
                                <label>结束:</label>
                                <input type="text" name="end" class="form-control timepicker2" placeholder="" value="{{{dateConv end}}}" style="width: 180px">
                            </div>
                        </div>
                    </td>
                </tr>

                <tr>
                    <td>排序</td>
                    <td>
                        <input type="number" name="sort" class="form-control" placeholder="" value="{{{sort}}}" style="width: 100px" min="0">
                    </td>
                </tr>
                <tr>
                    <td>操作</td>
                    <td style="text-align: center">
                        <button type="button" class="btn btn-danger myDelete" data-id="{{{id}}}">删除</button>&nbsp;&nbsp;&nbsp;&nbsp;
                        <button type="button" class="btn btn-info myEditPost" data-id="{{{id}}}">完成</button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </form>
    {{/.}}
</script>

<script type="text/template" id="addModal">
    <form>
        <div>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="25%">类别</th>
                    <th width="75%">内容</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>bodyId</td>
                    <td >
                        <div class="form-inline">
                            <div class="form-group">
                                <input type="text" name="id" class="form-control"  placeholder="" value="" style="width: 170px">
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>排序值</td>
                    <td >
                        <div class="form-inline">
                            <div class="form-group">
                                <input type="text" name="score" class="form-control"  placeholder="" value="" style="width: 170px">
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>操作</td>
                    <td style="text-align: center">
                        <button type="button" class="btn btn-info mySortPost">确定</button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </form>
</script>

<script type="text/template" id="eModal">
    <form>
        <div>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="25%">类别</th>
                    <th width="75%">内容</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>权重值</td>
                    <td >
                        <div class="form-inline">
                            <div class="form-group">
                                <input type="text" name="id" class="form-control"  placeholder="" value="{{{score}}}" style="width: 170px">
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>操作</td>
                    <td style="text-align: center">
                        <button type="button" class="btn btn-info myePost" data-id="{{{id}}}">确定</button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </form>
</script>

<script type="text/template" id="flushDayModal">
    <form>
        <div>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="25%">类别</th>
                    <th width="75%">内容</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>选择日期</td>
                    <td >
                        <div class="form-inline">
                            <div class="form-group">
                                <input type="text" name="day" class="form-control timepicker3"  placeholder="" value="" style="width: 200px">
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>操作</td>
                    <td style="text-align: center">
                        <button type="button" class="btn btn-info myFlushDayPost">确定</button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </form>
</script>

<script type="text/template" id="disModal">
    <div>
        <table class="table table-bordered">
            <thead>
            <tr>
                <th width="10%">楼层</th>
                <th width="10%">uid</th>
                <th width="55%">内容</th>
                <th width="15%">操作</th>
            </tr>
            </thead>
            <tbody class="dislist">

            </tbody>
        </table>
    </div>
    <div style="text-align: center;margin-top: 50px;margin-bottom: 50px">
        <button type="button" class="btn btn-default disNext" data-cid="{{{cid}}}" data-pos="0">下一页</button>
    </div>
</script>

<script type="text/template" id="disListModal">
    {{#.}}
    <tr>
        <th>{{{position}}}</th>
        <th>{{{uid}}}</th>
        <th>{{{content}}}</th>
        <th><button type="button" class="btn btn-danger myDelPos" data-cid="{{{cid}}}" data-pos="{{{position}}}" data-uid="{{{uid}}}">删除</button></th>
    </tr>
    {{/.}}
</script>

<!--template end-->


<!-- js placed at the end of the document so the pages load faster -->
<script src="<!--{eval echo register_static('js/jquery.js');}-->"></script>
<script src="<!--{eval echo register_static('js/bootstrap.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/pace.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/wow.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/jquery.nicescroll.js');}-->" type="text/javascript"></script>
<script src="<!--{eval echo register_static('js/jquery.app.js');}-->"></script>

<script src="<!--{eval echo register_static('js/handlebars-v4.0.5.js');}-->"></script>
<script src="<!--{eval echo register_static('js/handlebars-helper.js');}-->"></script>
<script src="<!--{eval echo register_static('layer/layer.js');}-->"></script>
<script src="<!--{eval echo register_static('laypage/laypage.js');}-->"></script>
<script src="<!--{eval echo register_static('laydate/laydate.js');}-->"></script>

<script src="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/datatables/dataTables.bootstrap.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.init.js');}-->"></script>

<!-- Modal-Effect -->
<script src="<!--{eval echo register_static('assets/modal-effect/js/classie.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/modal-effect/js/modalEffects.js');}-->"></script>

<script type="text/javascript">
    $(document).ready(function() {

        //编译模板
        var tp_tableCon = Handlebars.compile($('#tableCon').html());
        var tp_editModal = Handlebars.compile($('#editModal').html());
        var tp_addModal = Handlebars.compile($('#addModal').html());
        var tp_eModal = Handlebars.compile($('#eModal').html());
        var tp_disModal = Handlebars.compile($('#disModal').html());
        var tp_disListModal = Handlebars.compile($('#disListModal').html());
        var tp_flushDayModal = Handlebars.compile($('#flushDayModal').html());


        $('.myChoose').change(function () {
            _Where_.page = 1;
            var name = $(this).attr('name');
            switch (name){
                case 'type':
                    $(this).val() != 'no' ?  _Where_.type = $(this).val() : _Where_.type = undefined;
                    break;
                case 'face':
                    $(this).val() != 'no' ?  _Where_.face = $(this).val() : _Where_.face = undefined;
                    break;
            }
            RequestList();
        });

        $('.myAdd').click(function () {
            var html = tp_addModal();
            layer.open({
                type: 1,
                title: '新增',
                closeBtn: 1,
                area:['320px', '270px'],
                shadeClose: true,
                content: html
            });
        });


        //评论
        $(document).off('click', '.myDiscuss').on('click', '.myDiscuss', function () {
            var bodyid = $(this).data('id');
            var index = layer.load();
            $.post(
                    '/admin.php?ac=anonymous&op=dislist',
                    {bodyId:bodyid},
                    function (r) {
                        var html = tp_disModal({cid:bodyid});
                        layer.open({
                            type: 1,
                            title: '匿名评论',
                            closeBtn: 1,
                            area:['700px', '80%'],
                            shadeClose: true,
                            content: html
                        });
                        layer.close(index);
                        var html = tp_disListModal(r.result);
                        $('.dislist').append( html );
                        if (r.result && r.result.length>0){
                            if(r.result.length<20){
                                $('.disNext').remove();
                                return;
                            }
                            $('.disNext').data('pos', r.result[ r.result.length-1 ].position );
                        }else {
                            $('.disNext').remove();
                            return;
                        }
                    }
            );
        });

        $(document).off('click', '.disNext').on('click', '.disNext', function () {
            var bodyid = $(this).data('cid');
            var pos = $(this).data('pos');
            var index = layer.load();
            $.post(
                    '/admin.php?ac=anonymous&op=dislist',
                    {bodyId:bodyid, pos:pos},
                    function (r) {
                        layer.close(index);
                        var html = tp_disListModal(r.result);
                        $('.dislist').append( html );
                        if (r.result && r.result.length>0){
                            if(r.result.length<20){
                                $('.disNext').remove();
                                return;
                            }
                            $('.disNext').data('pos', r.result[ r.result.length-1 ].position );
                        }else{
                            $('.disNext').remove();
                            return;
                        }
                    }
            );
        });

        //删除
        $(document).off('click', '.myDelPos').on('click', '.myDelPos', function () {
            var bodyid = $(this).data('cid');
            var pos = $(this).data('pos');
            var uid = $(this).data('uid');
            var _this =$(this);
            layer.confirm('确定删除该楼层？', {icon: 3, title:'提示'}, function(i){
                var index = layer.load();
                $.post(
                        '/admin.php?ac=anonymous&op=disdel',
                        {bodyId:bodyid, pos:pos, uid:uid},
                        function (r) {
                            layer.close(index);
                            layer.close(i);
                            if (r._code == 1){
                                _this.parents('tr').remove();
                            }else{
                                layer.msg('删除失败', {icon: 0});
                            }
                        }
                );
            });
        });

        $(document).off('click', '.mySortPost').on('click', '.mySortPost', function () {
            var score = $(this).parents().find('input[name="score"]').val();
            var bodyId = $(this).parents().find('input[name="id"]').val();
            var that = $(this);
            var index = layer.load();
            $.post(
                    '/admin.php?ac=anonymous&op=addhotready&bodyId=' + bodyId + '&score='+score ,
                    function (r) {
                        layer.closeAll();
                        if(r._code == 1){
                            layer.msg('操作成功', {icon: 1});
                            RequestList();
                        }else{
                            layer.msg(r._msg, {icon: 0});
                        }
                    }
            );
        });

        $(document).off('click', '.myePost').on('click', '.myePost', function () {
            var score = $(this).parents().find('input[name="id"]').val();
            var bodyId = $(this).data('id');
            var that = $(this);
            var index = layer.load();
            $.post(
                '/admin.php?ac=anonymous&op=addhotready&bodyId=' + bodyId + '&score='+score ,
                function (r) {
                    layer.closeAll();
                    if(r._code == 1){
                        layer.msg('操作成功', {icon: 1});
                        RequestList();
                    }else{
                        layer.msg(r._msg, {icon: 0});
                    }
                }
            );
        })

        $(document).off('click', '.myDelete').on('click', '.myDelete', function () {
            var id = $(this).data('id');
            var uid = $(this).data('uid');
            var that = $(this);
            var index = layer.load();
            $.post(
                '/admin.php?ac=anonymous&op=delhotready&id=' + id + '&uid='+uid ,
                function (r) {
                    layer.close(index);
                    if(r._code == 1){
                        layer.closeAll();
                        layer.msg('已移除', {icon: 1});
                        RequestList();
                    }else{
                        layer.msg(r._msg, {icon: 0});
                    }
                }
            );
        });
        var actionData="";
        $(document).on('blur','form textarea[name="action_url"]',function(){
           actionData=$(this).val();
        });
        $(document).off('click', '.myAddPost').on('click', '.myAddPost', function () {
            if(!actionData){
                actionData=$('form textarea[name="action_url"]').text();
            }
            var checkRes = checkAction(actionData);
            if(!checkRes){
                layer.alert('action有误!');
                return 0;
            }
            var form = $(this).parents('form');
            var param = form.serialize();
            var types = form.find('[name="type"]').find("option:selected").text();

            layer.confirm('确定添加 <b>'+types+'</b> ？', {icon: 3, title:'提示'}, function(i){
                var index = layer.load();
                $.post(
                        '/admin.php?ac=activity2&op=add',
                        param,
                        function (r) {
                            layer.close(index);
                            if(r._code == 1){
                                layer.closeAll();
                                RequestList();
                                layer.msg('添加成功', {icon: 1});
                            }else{
                                layer.msg(r._msg, {icon: 0});
                            }
                        }
                );
            });
        });

        $(document).off('click', '.myRebuild').on('click', '.myRebuild', function () {
            layer.confirm('确定重新刷新精选？<br/>提示：你需要在自己电脑的host加上<br/> 112.124.20.101&nbsp;&nbsp;&nbsp;tips.ffrj.net 才能生效', {icon: 3, title:'提示'}, function(i){
                layer.load();
                layer.open({
                    type: 2,
                    title: '',
                    shadeClose: true,
                    closeBtn: 0,
                    shade: 0,
                    area: ['0px','0px'],
                    content: 'http://tips.ffrj.net/banner/create' //iframe的url
                });
                setTimeout(function () {
                    layer.closeAll();
                    layer.msg('操作成功');
                }, 1000);
            });
        });

        $(document).off('click', '.editSource').on('click', '.editSource', function () {
            var options = {
                'score' : $(this).data('score'),
                'id' : $(this).data('id')
            };
            var html = tp_eModal(options);
            layer.open({
                type: 1,
                title: '调整权重',
                closeBtn: 1,
                area:['400px', '300px'],
                shadeClose: true,
                content: html
            });
        });

        $(document).off('click', '.toLine').on('click', '.toLine', function () {
            layer.confirm('确定将待上线的匿名全部上线？', {icon: 3, title:'提示'}, function(i){
                var index = layer.load();
                $.post(
                    '/admin.php?ac=anonymous&op=ready2line',
                    {},
                    function (r) {
                        layer.closeAll();
                        if(r._code == 1){
                            layer.msg('上线成功', {icon: 1});
                        }else{
                            layer.msg(r._msg, {icon: 0});
                        }
                    }
                );
            });
        });

        $(document).off('click', '.myEditPost').on('click', '.myEditPost', function () {
            if(!actionData){
                actionData=$('form textarea[name="action_url"]').text();
            }
            var checkRes = checkAction(actionData);
            if(!checkRes){
                layer.alert('action有误!');
                return 0;
            }
            var id = $(this).data('id');
            layer.load();
            var param = $(this).parents('form').serialize();

            $.post(
                    '/admin.php?ac=activity2&op=editdetail&id=' + id,
                    param,
                    function (r) {
                        layer.closeAll();
                        if(r._code == 1){
                            RequestList();
                            layer.msg('更新成功', {icon: 1});
                        }else{
                            layer.msg(r._msg, {icon: 0});
                        }
                    }
            );

        });

        $(document).off('click', '.myEdit').on('click', '.myEdit', function () {
            var id = $(this).data('id');
            var index = layer.load();
            $.post(
                    '/admin.php?ac=activity2&op=msgdetail',
                    {id:id},
                    function (r) {
                        layer.close(index);
                        if(r._code == 1){
                            var html = tp_editModal(r.result);
                            layer.open({
                                type: 1,
                                title: '编辑消息',
                                closeBtn: 1,
                                area:['40%', '80%'],
                                shadeClose: true,
                                content: html
                            });
                        }else{
                            layer.msg(r._msg, {icon: 0});
                        }
                    }
            );

        });

        $(document).off('click', '.timepicker2').on('click', '.timepicker2', function () {
            laydate({
                format: 'YYYY-MM-DD hh:mm:ss',
                istime: true
            });
        });

        $(document).off('click', '.timepicker3').on('click', '.timepicker3', function () {
            laydate({
                format: 'YYYYMMDD',
                festival: true,
                istime: false
            });
        });

        $(document).off('click', '.showImg').on('click', '.showImg', function () {
            layer.tips('<img src="'+$(this).attr('src')+'" />', $(this), {
                tips: [2, '#fff'],
            });
        });

        $(document).off('change', '.actionChange').on('change', '.actionChange', function () {
            var NO = $(this).val();
            ActionChangeSelect(NO);
        });

        $(document).off('click', '#next').on('click', '#next', function () {
            RequestList();
        });

        _Where_ = {page:1};
        //请求数据列表数据
        var RequestList = function () {
            where = _Where_;
            if(typeof where == 'undefined')where = {};
            var index = layer.load();
            $.post(
                    '/admin.php?ac=anonymous&op=hotreadylist',
                    where,
                    function (r) {
                        if (r.result){
                            var html = tp_tableCon(r.result);
                            $('#tbody').html(html);
                            laypage({
                                cont: $('.pageCon'), //容器。值支持id名、原生dom对象，jquery对象。【如该容器为】：<div id="page1"></div>
                                pages: 100, //通过后台拿到的总页数
                                curr: _Where_.page || 1, //当前页
                                jump: function(obj, first){ //触发分页后的回调
                                    if(!first){ //点击跳页触发函数自身，并传递当前页：obj.curr
                                        _Where_.page = obj.curr;
                                        RequestList();
                                    }
                                }
                            });
                        }else{
                            layer.msg('没有更多了', {icon: 0});
                        }
                        layer.close(index);
                    }
            );
        }
        RequestList();

    });
    function checkAction(aa){
        console.log(aa);
        var bb="pinksns://diary/info?";
        if(aa.indexOf(bb)!=-1){
            var check = true;
            var cc=aa.substr(bb.length);
            var dd=cc.split("&");
            for(var val in dd){
                if(dd[val].indexOf("bodyId")!=-1||dd[val].indexOf("uid")!=-1){
                    check = true;
                }else{
                    check = false;
                    break;
                }
            }
            return check;
        }

        var bbb="pinksns://group/topic?";
        if(aa.indexOf(bbb)!=-1){
            var check = true;
            var cc=aa.substr(bb.length);
            var dd=cc.split("&");
            console.log(dd);
            for( val in dd){
                if(dd[val].indexOf("tid")!=-1||dd[val].indexOf("uid")!=-1 || dd[val].indexOf("gid")!=-1){
                    check = true;
                }else{
                    check = false;
                    break;
                }
            }
            return check;
        }
        return true;
    }
</script>
</body>
</html>
